package com.weigee.ktv.v.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.l.d.app.library.app.FragActivity;
import com.l.d.app.library.util.ToastUtil;
import com.weigee.ktv.R;
import com.weigee.ktv.m.retrofit.ApiRequest;
import com.weigee.ktv.v.activity.ActivityUtil;
import com.weigee.ktv.v.activity.StandardActivity;
import com.weigee.ktv.v.view.WrapTitleBar;

import butterknife.BindView;
import butterknife.OnClick;
import skin.support.widget.SkinCompatTextView;

/**
 * Created by linde on 2017/04/21.
 * <p/>
 * 我的钱包数据
 */
public class MyWalletDataFragment extends BaseFragment {
    @BindView(R.id.wrap_title_bar)
    WrapTitleBar mTitleBar;
    @BindView(R.id.tv_balance)
    SkinCompatTextView m_tvBalance;

    @BindView(R.id.tv_recharge_return)
    SkinCompatTextView m_tvRechargeReturn;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.walletdata_frag, container, false);
    }

    @Override
    protected void initView(View view, @Nullable Bundle savedInstanceState) {
        mTitleBar.setTitle("钱包");
        mTitleBar.setLeftButton(View.VISIBLE, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                back();
            }
        });

        m_tvRechargeReturn.setSelected(true);

        ApiRequest.balance(m_tvBalance);
    }

    @OnClick(R.id.item_recharge_return)
    protected void onRechargeReturnClick(View view) {
        // 充值返利
        FragActivity.start(StandardActivity.class, view.getContext(), ActivityUtil.RECHARGE_RETURN);
    }

    @OnClick(R.id.item_payed)
    protected void onPayedClick(View view) {
        // 付款
        ToastUtil.makeTest(view.getContext(), "付款");
    }

    @OnClick(R.id.item_transaction_history)
    protected void onTransactionHistoryClick(View view) {
        // 交易记录
        FragActivity.start(StandardActivity.class, view.getContext(), ActivityUtil.TRANSACTION_HISTORY);
    }

    @OnClick(R.id.item_safety_settings)
    protected void onSafetySettingsClick(View view) {
        // 安全设置
        FragActivity.start(StandardActivity.class, view.getContext(), ActivityUtil.SAFETY_SETTINGS);
    }
}
